﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace T3._4.Controllers
{
    public class DefaultController : Controller
    {
        // GET: Default
        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Index(HttpPostedFileBase file)
        {
            if (file != null)
            {
                var rnd = new Random();
                var fileName = DateTime.Now.ToString("yyyyMMddhhss") + rnd.Next(100, 999) + System.IO.Path.GetExtension(file.FileName);
                file.SaveAs(Server.MapPath("^/Models/" + file.FileName));
            }
            return View();
        }
      
    }
}